#include "Statement.h"
#include "../Game/Level.h"

//Evaluate a Rule
bool cStatement::Eval()
{
  cLevel &lLevel = cLevel::Get();
  switch(meType)
  {
    case eStatementContent:
        return lLevel.IsInCell( msParam1[0], msParam2);
      break;
    case eStatementCapture:
        return lLevel.IsInPlayerCell(msParam1);
      break;
    default:
      return false;
      break;
  }
}

//Do actions according to a rule
void cStatement::Do()
{
  cLevel &lLevel = cLevel::Get();
  switch(meType)
  {
    case eStatementRemove:
      lLevel.RemoveObject(msParam1);
      break;
    case eStatementMessage:
      lLevel.SetMessage(msParam1);
      break;
    case eStatementMove:
      lLevel.MoveObject(msParam1, msParam2[0]);
      break;
    case eStatementExit:
      lLevel.QuitLevel();
      break;
    case eStatementDialogue:
      lLevel.Dialogue(msParam1);
      break;
  }
}